package io.yunho.yunho.interview.one.singleton.autocreate;

import java.io.IOException;
import java.util.Properties;

/**
 * @author: Jason
 * @date: 2021/3/6 10:15
 * @description:
 */
public class SingletonStatic {
    public static SingletonStatic INSTANCE;
    private String name;
    static {
        Properties properties = new Properties();
        try {
            properties.load(SingletonStatic.class.getClassLoader().getResourceAsStream("single.properties"));
            String propertyName = properties.getProperty("name");
            INSTANCE = new SingletonStatic(propertyName);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    private SingletonStatic(String name){
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "SingletonStatic{" +
                "name='" + name + '\'' +
                '}';
    }
}
